import Vue from 'vue'
import Router from 'vue-router'

import Main from '../views/Main'
import Login from '../views/Login'


import list from '../views/List'
import profile from '../views/Profile'
import notFound from '../views/404'
import prime from '../views/prime'

Vue.use(Router)
Vue.use(Main)

export default new Router({
  mode:'history',
  routes:[
    {
      path: '/main/:username',
      component:Main,
      props:true,
      name:'main1',
      children: [
        {path: '/list',component:list},
        // {path: '/profile',component:profile}
        {path: '/profile/:id/:name/:age',
          name:'UserProfile',//name必须用单引号，否则会使所有的页面不能加载
          component:profile,
          props:true}//开启props用来解耦
      ]
    },
    {
      path: "/login",
      component:Login
    },
    {
      path:"/gohome",
      redirect:'/main'
    },
    {
       path:"*",
       component:notFound
    },
    {
       path: "/pri",
       component: prime
    }
  ]
});
